home *** CD-ROM | disk | FTP | other *** search
-
- #ifndef __ENGINECORE_H_
- #define __ENGINECORE_H_
- /*
- Peon - Win32 Games Programming Library
- Copyright (C) 2002-2005 Erik Yuzwa
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Erik Yuzwa
- peon AT wazooinc DOT com
- */
-
- #include "ISingleton.h"
- #include "Timer.h"
- #include "SceneRenderer.h"
- #include "AudioEngine.h"
- #include "InputEngine.h"
- #include "IApplication.h"
-
- namespace peon
- {
- /**
- * This is our main entry object for the Peon library
- *
- * This object is responsible for kicking off a main window
- * that we can draw to, along with a lot of the core subsystems
- * involved in the engine.
- */
- class PEONMAIN_API EngineCore : ISingleton<EngineCore>
- {
- public:
- /** Handle to our IniConfigReader instance */
- IniConfigReader* m_pConfig;
-
- /** Handle to our IApplication instance */
- IApplication* m_pApplication;
-
- /** Handle to our Renderer instance for rendering scene geometry */
- SceneRenderer* m_pVideoDevice;
-
- /** Our Timer object which encapsulates some system time calls */
- Timer m_oTimer;
-
- /** The frames per second of our rendering loop */
- float m_fps;
-
-
-
- protected:
- /**
- * This method is responsible for updating the frame rate counter
- */
- void updateFPS();
-
- public:
- /**
- * Constructor
- */
- EngineCore();
-
- /**
- * Destructor
- */
- ~EngineCore();
-
- /** Override standard Singleton retrieval.
- @remarks
- Why do we do this? Well, it's because the Singleton
- implementation is in a .h file, which means it gets compiled
- into anybody who includes it. This is needed for the
- Singleton template to work, but we actually only want it
- compiled into the implementation of the class based on the
- Singleton, not all of them. If we don't change this, we get
- link errors when trying to use the Singleton-based class from
- an outside dll.
- @par
- This method just delegates to the template version anyway,
- but the implementation stays in this single compilation unit,
- preventing link errors.
- */
- static EngineCore& getSingleton(void);
- /** Override standard Singleton retrieval.
- @remarks
- Why do we do this? Well, it's because the Singleton
- implementation is in a .h file, which means it gets compiled
- into anybody who includes it. This is needed for the
- Singleton template to work, but we actually only want it
- compiled into the implementation of the class based on the
- Singleton, not all of them. If we don't change this, we get
- link errors when trying to use the Singleton-based class from
- an outside dll.
- @par
- This method just delegates to the template version anyway,
- but the implementation stays in this single compilation unit,
- preventing link errors.
- */
- static EngineCore* getSingletonPtr(void);
-
- /**
- * This method loads and initializes the subsystems of the
- * Peon library...audio, video, input and network
- * @param strWindowTitle - our window title
- * @param strIniConfig - path to the INI Configuration information
- * @return bool - false if anything failed
- */
- bool loadEngine( const String& strWindowTitle, const String& strIniConfig );
-
- /**
- * This method unloads and frees up every allocated subsystem
- */
- void unloadEngine();
-
- /**
- * This puts the Peon engine into an endless cycle. Our "main loop"
- * for the game.
- * @return int - negative value if anything went wrong
- */
- int runEngine();
-
- /**
- * This
- * @return bool -
- */
- bool setApplication( IApplication* pApplication );
-
- /**
- * This method is just an accessor for our SceneRenderer instance
- * @return SceneRenderer* - our renderer
- */
- SceneRenderer* getRenderer(){ return m_pVideoDevice; }
-
- /**
- * This method is an accessor to grab the IApplication instance
- * IApplication* - our IApplication instance
- */
- IApplication* getApplication(){ return m_pApplication; }
-
-
- };
- }
-
- #endif
-
-